CC=gcc
CFLAGS=-c -g
LFLAGS=-g -lm -lgc

all: symce-static libsymce.so symce

libsymce.so: Diff.o Expand.o Expression.o Fraction.o Integers.o Multitree.o Mystrcat.o Number.o Numeric.o Reduce.o Symbol.o Taylor.o Tuplets.o
	$(CC) $(LFLAGS) -shared Diff.o Expand.o Expression.o Fraction.o Integers.o main.o Multitree.o Mystrcat.o Number.o Numeric.o Reduce.o Symbol.o Taylor.o Tuplets.o -o libsymce.so


symce-static: Diff.o Expand.o Expression.o Fraction.o Integers.o main.o Multitree.o Mystrcat.o Number.o Numeric.o Reduce.o Symbol.o Taylor.o Tuplets.o
	$(CC) $(LFLAGS) Diff.o Expand.o Expression.o Fraction.o Integers.o main.o Multitree.o Mystrcat.o Number.o Numeric.o Reduce.o Symbol.o Taylor.o Tuplets.o -o symce-static

symce: main.o libsymce.so
	$(CC) $(LFLAGS) -L. -lsymce main.o -o symce

clean:
	rm *.o libsymce.so symce symce-static

#Sources
Diff.c: Diff.h
Diff.h: Multitree.h
Expand.c: Expand.h
Expand.h: Multitree.h
Expression.c: Multitree.h
Multitree.c: Multitree.h Mystrcat.h
Multitree.h: Symbol.h
Mystrcat.c: Mystrcat.h
Numeric.h: Multitree.h
Reduce.c: Tuplets.h
Symbol.c: Symbol.h
Symbol.h: Number.h
Taylor.c: Multitree.h
Tuplets.c: Tuplets.h
Tuplets.h: Multitree.h
main.c: Multitree.h

#object files
Diff.o: Diff.c
	$(CC) $(CFLAGS) Diff.c
Expand.o: Expand.c
	$(CC) $(CFLAGS) Expand.c
Expression.o: Expression.c
	$(CC) $(CFLAGS) Expression.c
Multitree.o: Multitree.c
	$(CC) $(CFLAGS) Multitree.c
Mystrcat.o: Mystrcat.c
	$(CC) $(CFLAGS) Mystrcat.c
Numeric.o: Numeric.c
	$(CC) $(CFLAGS) Numeric.c
Reduce.o: Reduce.c
	$(CC) $(CFLAGS) Reduce.c
Symbol.o: Symbol.c
	$(CC) $(CFLAGS) Symbol.c
Taylor.o: Taylor.c
	$(CC) $(CFLAGS) Taylor.c
Tuplets.o: Tuplets.c
	$(CC) $(CFLAGS) Tuplets.c
main.o: main.c
	$(CC) $(CFLAGS) main.c

#additional sources
Fraction.c: Fraction.h
Fraction.h: Integers.h
Integers.c: Integers.h
Number.c: Mystrcat.h Number.h
Number.h: Fraction.h

#additional object files
Fraction.o: Fraction.c
	$(CC) $(CFLAGS) Fraction.c
Integers.o: Integers.c
	$(CC) $(CFLAGS) Integers.c
Number.o: Number.c
	$(CC) $(CFLAGS) Number.c


